package com.my.buffers;

import java.io.*;

/**
 * @description:
 * @author: marshal
 * @date: 2021-08-24 4:05 PM
 */
public class BufferedWriterTest {
    public static void main(String[] args) {
        try (
                var fr = new FileReader("file/br.txt");
                var br = new BufferedReader(fr);
                var fw = new FileWriter(("file/bw.txt"));
                var bw = new BufferedWriter(fw)
        ) {
            char[] buff = new char[1024];
            // he number of characters read
            var hasRead = 0;
            while ((hasRead = br.read(buff)) != -1) {
                bw.write(buff, 0, hasRead);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
